﻿@using System.Data
@using ZoomLa.Common
@using ZoomLa.BLL.Helper
@functions{
public string getNowWeek()
{
    string week = "";
    switch (DateTime.Now.DayOfWeek)
    {
        case DayOfWeek.Monday:
            week = "周一";
            break;
        case DayOfWeek.Tuesday:
            week = "周二";
            break;
        case DayOfWeek.Wednesday:
            week = "周三";
            break;
        case DayOfWeek.Thursday:
            week = "周四";
            break;
        case DayOfWeek.Friday:
            week = "周五";
            break;
        case DayOfWeek.Saturday:
            week = "周六";
            break;
        case DayOfWeek.Sunday:
            week = "周日";
            break;
        default:
            break;
    }
    return week;
}
}
@{
string tycount = ViewBag.tycount;
DataTable cartdt = ViewBag.cartdt;
Layout = "_PostBar.cshtml";
}
@section head{
<title>社区_@Call.SiteName</title>
<script src="/js/scrolltopcontrol.js"></script>
<script src="/JS/ICMS/ZL_Common.js"></script>
<style>
.club_div_img img { width:150px;}
</style>
}
@section content{
<div class="container">
    <div class="row">
        <div class="col-lg-9 col-md-9 col-sm-9 col-xs-12">
            <h5 class="well well-sm">
                <strong>社区热点</strong>
                <div class="pull-right">
                    今日:@tycount.Split(':')[0]
                    昨日:@tycount.Split(':')[1]
                </div>
            </h5>
            <div class="col-lg-5 col-md-5 col-sm-5 col-xs-12 padding_l_r0">
                <div id="carousel-example-generic" class="carousel slide clubShow" data-ride="carousel">
                    <ol class="carousel-indicators">
                        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
                        <li data-target="#carousel-example-generic" data-slide-to="3"></li>
                    </ol>
                    <div class="carousel-inner" role="listbox">
                        @foreach (DataRow dr in ((DataTable)ViewBag.rpt_top).Rows)
                        {
                            <div class="item @(dr["index"].ToString().Equals("0") ? "active" : "")">
                                <a href="/PItem?id=@dr["id"]">
                                    <img src="@dr["topimg"]" alt="@dr["Title"]">
                                </a>
                                <div class="carousel-caption">@dr["Title"]</div>
                            </div>
                        }
                    </div>
                    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                        <span class="sr-only">Previous</span>
                    </a>
                    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                        <span class="sr-only">Next</span>
                    </a>
                </div>
            </div>

            <div class="col-lg-7 col-md-7 col-sm-7 col-xs-12">
                <ul class="list-unstyled navlist">
                    @foreach (DataRow dr in ((DataTable)ViewBag.rpt_focus).Rows)
                    {
                        <li>
                            <a href="/PClass?id=@dr["CateID"]" class="navname">[@dr["CateName"]]</a>
                            <a href="/PItem?id=@dr["ID"]">@StringHelper.SubStr(dr["Title"], 32)</a>
                        </li>
                    }
                </ul>
            </div>
            <div class="clearfix"></div>
            @{
                foreach (DataRow dr in ((DataTable)ViewBag.rpt_cart).Rows)
                {
                    cartdt.DefaultView.RowFilter = " ParentID=" + dr["CateID"].ToString();
                    DataTable childDT = cartdt.DefaultView.ToTable();
                    <h5 class="well well-sm margin_bottom0"><a href="/PClass?id=@dr["cateid"]">>@dr["CateName"]</a></h5>
                    <table class="table margin_bottom0 club_list">
                        @foreach (DataRow item in childDT.Rows)
                        {
                            <tr>
                                <td class="club_div_img">
                                    <a href="/PClass?id=@item["cateid"]" title="@item["CateName"]">
                                        <img src="@item["barimage"]" onerror="shownopic(this);" />
                                    </a>
                                </td>
                                <td class="cateName">
                                    <a href="/PClass?id=@item["cateid"]">@item["CateName"]</a>
                                </td>
                                <td>
                                    <span class="card_menNum" title="主题">@item["ItemCount"]</span><span title="回贴">/@item["ReCount"]</span>
                                </td>
                                <td class="club_bar_status">
                                    <div>
                                        最新帖子：<a href="/PItem?id=@item["id"]">@item["Title"]</a>
                                    </div>
                                    <div class="barDate">
                                        回复时间：@ZoomLa.Common.function.GetBarDate(item["R_CDate"])
                                    </div>
                                </td>
                            </tr>
                        }
                    </table>
                }
            }
        </div>
        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 padding_l0">
            <div class="mailRight_Puch">
                <div class="date">
                    @DateTime.Now.ToString("MM月dd日")<span>@getNowWeek()</span>
                </div>
                <div class="cont">
                    <a href="#">每日打卡</a>
                </div>
            </div>
            <div class="mailRight_Hot_Tile">本周热门</div>
            <ul class="mailRight_Hot_li">
            @foreach (DataRow dr in ((DataTable)ViewBag.rpt_week).Rows)
            {
                <li>
                    <div class="badge pull-left">@dr["IndexNum"]</div>
                    <p><a href="/PItem?id=@dr["id"]" class="hoturl">@dr["Title"]</a><span class="hotdate pull-right">@ZoomLa.Common.function.GetBarDate(dr["CDate"])</span></p>
                </li>
            }
            </ul>
            <div class="col-xs-12 col-md-12 padding_l_r0">
                <a href="#" class="thumbnail">
                    <img data-src="holder.js/100%x180" alt="预留广告位" style="height: 122px;">
                </a>
                <div class="bar_right">
                    <div class="bar_user_t">友情链接</div>
                    <ul>
                        @Call.MVCLabel("{ZL.Label id=\"友情链接列表\" ShowNum=\"10\" NodeID=\"88\" /}")
                    </ul>
                </div>
            </div>
        </div>
        <!--右边结束 -->
    </div>
</div>
<div class="container">
    <div class="row">
        <div class="bar_con padding5">
            <div class="col-lg-9 col-md-9 col-sm-9 col-xs-12 padding10">
                <div class="bar_tui">
                    <div class="bar_tui_t">社区推荐</div>
                    <div class="row">
                        <div class="padding10">
                            @Call.MVCLabel("{ZL.Label id=\"输出推荐贴吧列表\" ShowNum=\"2\" /}")
                        </div>
                    </div>
                    <div class="bar_tui_t" style="margin-bottom: 0;">其他社区</div>
                    <div class="bar_other">
                        <div class="row">
                            <ul class="list-unstyled">
                                @Call.MVCLabel("{ZL.Label id=\"输出非推荐贴吧列表\" ShowNum=\"8\" /}")
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="bar_dong">
                    <div class="bar_dong_t"><span><a href="#">更多</a></span>社区动态</div>
                    <div class="bar_dong_c">
                        <ul class="list-unstyled" id="bar_dongul">
                            @Call.MVCLabel("{ZL.Label id=\"输出贴吧动态_仅精华帖\" ShowNum=\"20\" /}")
                        </ul>
                        <div class="bar_dong_cmore" hidden>
                            <button type="button" onclick="GetMore();" class="btn btn-default"><span>加载更多</span></button>
                        </div>
                    </div>
                </div>
            </div>
            <!--左侧结束-->
            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 padding_l0">
                <div class="bar_right">
                    @Call.MVCLabel("{ZL.Label id=\"贴吧获取当前用户信息\"/}")
                    <div class="bar_daren">
                        <div class="bar_user_t">社区达人</div>
                        <div class="row">
                            <ul class="list-unstyled">
                                @Call.MVCLabel("{ZL.Label id=\"输出贴吧达人\" ShowNum=\"9\" /}")
                                <div class="clearfix"></div>
                            </ul>
                        </div>
                    </div>
                    <!--bar_daren end-->
                    <div class="bar_hot">
                        <div class="bar_user_t">热帖推荐</div>
                        <ul class="list-unstyled homehotbas">
                            @Call.MVCLabel("{ZL.Label id=\"输出热帖推荐\" ShowNum=\"5\" TitleNum=\"40\" /}")
                            <div class="clearfix"></div>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <!--bar_hot end-->
                    <div class="bar_test">
                        <div class="bar_user_t">热点新闻</div>
                        <ul class="list-unstyled">
                            @Call.MVCLabel("{ZL.Label id=\"贴吧输出热点新闻\" NodeID=\"1\" TitleNum=\"20\" ShowNum=\"2\" SysNum=\"40\" /}")
                        </ul>
                    </div>
                </div>
            </div>
            <!--右侧侧结束-->
            <div class="clearfix"></div>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal" data-hasload="0" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">友情提示</h4>
            </div>
            <div class="modal-body">
                暂无更多内容！！
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">返回</button>
            </div>
        </div>
    </div>
</div>
}
@section script{
    <script>
        var num = 10;
        var allnum = '@Call.MVCLabel("{ZL.Label id=\"输出贴吧贴子总数\"/}")'

        function GetMore() {
            if (num >= parseInt(allnum)) {
                $('#myModal').modal('show');
                $('#myModal').data("hasload", "1");
            }
            else {
                num += 10;
                $("#bar_dongul").load("/Class_1/NodeHot.aspx?Num=" + num + "&v=" + Math.floor(Math.random() * 1000 + 1) + " start");
            }
        }
        $(function () {
            $(window).scroll(function () {
                var _top = $(window).scrollTop();
                if (_top >= $(document).height() - $(window).height()) {
                    if ($('#myModal').data("hasload") == "0"){
                        //GetMore();
					}
                }
            })
        });
    </script>
}
